import React from "react";


// 通过ref来获取一个东西，把这个东西传给子组件，子组件调用这个东西
// ref的回调函数

// React.forwardRef  返回一个组件
const FancyButton = React.forwardRef((props, ref) => (
    

    <button ref={ref} className="FancyButton">
      {props.children}
    </button>
    
    
  ));

class App extends React.Component{

    constructor(){
        super()

        this.Button_ref=React.createRef();
    }

    componentDidMount(){
        console.log(this.Button_ref)
    }

    render() {
        return (
             <div>
                <FancyButton ref={this.Button_ref}>

                </FancyButton>
             </div>
        );
    }
}


  export default App